
import java.awt.*;
import java.awt.event.*;
import java.util.EventListener;
import javax.swing.*;

public class ControlPanel extends JPanel {

  protected JButton clearButton;
  protected JComboBox comboBox;
  protected JButton deleteButton, refreshButton;

  /* Constructor  */

  public ControlPanel() { 
	  refreshButton = new JButton("Refresh");
	add(refreshButton);
	
    clearButton = new JButton("Clear");
    clearButton.setEnabled(true);
    add(clearButton);
    deleteButton = new JButton("Delete Selected Object");
    deleteButton.setEnabled(true);
    add(deleteButton);
    
    add(new JLabel("Pen color"));
    comboBox = new JComboBox();
    comboBox.addItem("black");
    comboBox.addItem("blue");
    comboBox.addItem("cyan");
    comboBox.addItem("gray");
    comboBox.addItem("green");
    comboBox.addItem("magenta");
    comboBox.addItem("orange");
    comboBox.addItem("pink");
    comboBox.addItem("red");
    comboBox.addItem("white");
    comboBox.addItem("brown");
    comboBox.addItem("yellow");
    
    add(comboBox);
  }

  protected void addControlPanelListener(EventListener listener)  {
    clearButton.addActionListener((ActionListener)listener);
    deleteButton.addActionListener((ActionListener)listener);
    refreshButton.addActionListener((ActionListener)listener);
    comboBox.addItemListener((ItemListener)listener);
  }
}
